From e059988896d694d79a5554cb50e9c54e9f2e4974 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Thu, 4 Sep 2008 21:29:22 +0000 Subject: [PATCH] Check input file for unicode format. --- arcdist.c | 1 + compegps.c | 1 + cst.c | 1 + g7towin.c | 1 + gopal.c | 2 ++ gpsutil.c | 1 + igc.c | 1 + main.c | 1 + netstumbler.c | 1 + nmea.c | 1 + nmn4.c | 1 + overlay.c | 1 + ozi.c | 1 + pcx.c | 1 + polygon.c | 1 + stmsdf.c | 1 + stmwpp.c | 1 + tiger.c | 1 + tmpro.c | 1 + 19 files changed, 20 insertions(+) diff --git a/arcdist.c b/arcdist.c index ecbc75db2..3b9a87640 100644 --- a/arcdist.c +++ b/arcdist.c @@ -63,6 +63,7 @@ arcdist_process(void) gbfile *file_in; file_in = gbfopen(arcfileopt, "r", MYNAME); + (void) gbfunicode(file_in); /* check for unicode text file */ lat1 = lon1 = lat2 = lon2 = BADVAL; while ((line = gbfgetstr(file_in))) { diff --git a/compegps.c b/compegps.c index f726fdeed..e33793ab9 100644 --- a/compegps.c +++ b/compegps.c @@ -335,6 +335,7 @@ static void compegps_rd_init(const char *fname) { fin = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); input_datum = DATUM_WGS84; } diff --git a/cst.c b/cst.c index 34f9b44d4..e22d43cc6 100644 --- a/cst.c +++ b/cst.c @@ -139,6 +139,7 @@ static void cst_rd_init(const char *fname) { fin = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); temp_route = NULL; } diff --git a/g7towin.c b/g7towin.c index 2aca83e66..acf7cebe1 100644 --- a/g7towin.c +++ b/g7towin.c @@ -361,6 +361,7 @@ static void rd_init(const char *fname) { fin = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); gardown = 1; mode = wptdata; diff --git a/gopal.c b/gopal.c index 0767227e3..89175e265 100644 --- a/gopal.c +++ b/gopal.c @@ -126,6 +126,8 @@ gopal_rd_init(const char *fname) if (global_opts.debug_level > 1) fprintf(stderr,"setting minspeed to %5.1lf km/h and maxspeed to %5.1lf km/h\n",minspeed,maxspeed); fin = gbfopen(fname, "r", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); + memset(buff,0,sizeof(buff)); if (optdate) { diff --git a/gpsutil.c b/gpsutil.c index d9f7dcbe3..ccd59c163 100644 --- a/gpsutil.c +++ b/gpsutil.c @@ -30,6 +30,7 @@ static void rd_init(const char *fname) { file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); } static void diff --git a/igc.c b/igc.c index 94d50d0d7..64738509c 100644 --- a/igc.c +++ b/igc.c @@ -112,6 +112,7 @@ static void rd_init(const char *fname) char *ibuf; file_in = gbfopen(fname, "r", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); // File must begin with a manufacturer/ID record if (get_record(&ibuf) != rec_manuf_id || sscanf(ibuf, "A%3[A-Z]", manufacturer) != 1) { diff --git a/main.c b/main.c index 6b0a2d99e..9109e67f7 100644 --- a/main.c +++ b/main.c @@ -84,6 +84,7 @@ load_args(const char *filename, int *argc, char **argv[]) char **argv2; fin = gbfopen(filename, "r", "main"); + (void) gbfunicode(fin); /* check for unicode text file */ while ((str = gbfgetstr(fin))) { str = lrtrim(str); if ((*str == '\0') || (*str == '#')) continue; diff --git a/netstumbler.c b/netstumbler.c index 1667e5154..f92d461ce 100644 --- a/netstumbler.c +++ b/netstumbler.c @@ -55,6 +55,7 @@ static void rd_init(const char *fname) { file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); macstumbler = 0; } diff --git a/nmea.c b/nmea.c index 1f6955627..6c28121dd 100644 --- a/nmea.c +++ b/nmea.c @@ -287,6 +287,7 @@ nmea_rd_init(const char *fname) read_mode = rm_file; file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); } static void diff --git a/nmn4.c b/nmn4.c index d61d272e2..470c932ba 100644 --- a/nmn4.c +++ b/nmn4.c @@ -273,6 +273,7 @@ static void nmn4_rd_init(const char *fname) { fin = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); } static void diff --git a/overlay.c b/overlay.c index b0da23e9e..3c96f40a1 100644 --- a/overlay.c +++ b/overlay.c @@ -153,6 +153,7 @@ static void ovl_rd_init(char const *fname) { fpin = gbfopen(fname, "r", MYNAME); + if (gbfunicode(fpin)) cet_convert_init(CET_CHARSET_UTF8, 1); } #define SECTION_NONE 0 diff --git a/ozi.c b/ozi.c index fafa5bd25..cb953f43f 100644 --- a/ozi.c +++ b/ozi.c @@ -394,6 +394,7 @@ static void rd_init(const char *fname) { file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); mkshort_handle = mkshort_new_handle(); ozi_init_units(0); diff --git a/pcx.c b/pcx.c index d447ec76f..37ced9f21 100644 --- a/pcx.c +++ b/pcx.c @@ -54,6 +54,7 @@ static void rd_init(const char *fname) { file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); } static void diff --git a/polygon.c b/polygon.c index 5f2abce18..5a3d3a2eb 100644 --- a/polygon.c +++ b/polygon.c @@ -259,6 +259,7 @@ polygon_process(void) gbfile *file_in; file_in = gbfopen(polyfileopt, "r", MYNAME); + (void) gbfunicode(file_in); /* check for unicode text file */ olat = olon = lat1 = lon1 = lat2 = lon2 = BADVAL; while ((line = gbfgetstr(file_in))) { diff --git a/stmsdf.c b/stmsdf.c index ba82e8789..3c0f7ebb9 100644 --- a/stmsdf.c +++ b/stmsdf.c @@ -336,6 +336,7 @@ static void rd_init(const char *fname) { fin = gbfopen(fname, "r", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); lineno = 0; route = NULL; diff --git a/stmwpp.c b/stmwpp.c index a2f3081ed..762fe21ce 100644 --- a/stmwpp.c +++ b/stmwpp.c @@ -61,6 +61,7 @@ static void stmwpp_rd_init(const char *fname) { fin = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(fin)) cet_convert_init(CET_CHARSET_UTF8, 1); track = NULL; route = NULL; wpt = NULL; diff --git a/tiger.c b/tiger.c index 4b0ae8385..f8f4b2040 100644 --- a/tiger.c +++ b/tiger.c @@ -99,6 +99,7 @@ static void rd_init(const char *fname) { file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); mkshort_handle = mkshort_new_handle(); } diff --git a/tmpro.c b/tmpro.c index ee632250e..8028123ac 100644 --- a/tmpro.c +++ b/tmpro.c @@ -45,6 +45,7 @@ static void rd_init(const char *fname) { file_in = gbfopen(fname, "rb", MYNAME); + if (gbfunicode(file_in)) cet_convert_init(CET_CHARSET_UTF8, 1); } static void -- 2.30.2